/-boot
/-docs
/-editor
/-files
/-files-old
/-imports
/-layout
/-shell
/-storage
/-storage/attached
/-storage/attached/api
/-storage/attached/dom
/-storage/attached/indexedDB
DetectStorage.ts
FileData.ts
LoadStorage.ts
MetadataData.ts
StorageAccess.ts
StorageDetect.ts
UpdateStorage.ts
functions.ts
/-storage/attached/localStorage
/-storage/attached/webSQL
/-tests ...
/-tests/files
/-tests/storage
/-tests/storage/attached
AttachedStorageTests.ts
AttachedStorageTestsNew.ts
DomStorageTests.ts
IndexedDBStorageTests.ts
LocalStorageStorageTests.ts
WebSQLStorageTests.ts
TestCase.html
TestCase.ts
TestPage.css
TestPage.html
TestPage.ts
_sampleTests.ts
teapo-tests.html
teapo-tests.ts
/-typings
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
try.html
try.js
x
80
      var nextTest = this.notStarted.shift();
81
      this.running.push(nextTest);
82
​
83
      nextTest.start(() => {
84
​
85
        this.running.remove(nextTest);
86
​
87
        var newState = nextTest.state();
88
​
89
        var targetCollection =
90
          newState === TestCase.State.Succeeded ? this.succeeded :
91
          newState === TestCase.State.Failed ? this.failed :
92
          null;
93
​
94
        if (targetCollection) {
95
          var targetCollectionArray = targetCollection();
96
​
97
          // iterate backwards, as the tests are likely to complete in the order they started
98
          for (var i = targetCollectionArray.length - 1; i >= 0; i--) {
99
            var t = targetCollectionArray[i];
100
            if (nextTest.name > t.name) {
101
              targetCollection.splice(i + 1, 0, nextTest);
102
              return;
103
            }
104
          }
105
​
106
          targetCollection.unshift(nextTest);
107
        }
108
      });
109
    }
110
​
111
    private _loadTests(namespace: any) {
112
​
113
      var byName: { [name: string]: TestCase; } = {};
114
      var names: string[] = [];
115
​
116
      TestPage.forEachTest(namespace, (name, _this_, test) => {
117
        if (this._urlHash) {
118
​
119
          if (name.indexOf(this._urlHash) < 0)
120
            return;
121
          if (namespace && (namespace + '.' + name).indexOf(this._urlHash) < 0)
122
            return;
123
          if (namespace && (namespace + name).indexOf(this._urlHash) < 0)
124
            return;
125
        }
126
        
127
        var testCase = new TestCase(name, _this_, test);
128
        byName[name] = testCase;
129
        names.push(name);
130
      });
131
​
132
      names.sort();
133
      forEach(names, name => {
134
        var testCase = byName[name];
135
        this.all.push(testCase);
136
      });
137
​
138
      this.notStarted(this.all);
139
​
140
    }
141
​
142
    static forEachTest(namespace: any, callback: (name: string, _this_: any, test: () => void) => void) {
143
​
144
      for (var k in namespace) {
145
        if (!k || k.charAt(0) === '_' || Object.prototype[k]) continue;
146
​
147
        var t = namespace[k];
148
        if (typeof t === 'function') {
149
          var isClass = false;
150
          for (var k in t.prototype) {
151
            if (!k || Object.prototype[k]) continue;
152
            
153
            isClass = true;
154
            break;
155
          }
156
​
157
          if (isClass) {
158
            if (!t.length)
159
              TestPage.forEachTest(
160
                new t(),
161
                (name, _this_, test) => callback(k + '.' + name, _this_, test));
162
          }
163
          else {
164
            callback(k, namespace, t);
165
          }
166
        }
167
        else if (typeof t === 'object') {
168
          TestPage.forEachTest(
169
            t,
170
            (name, _this_, test) => callback(k+'.'+name, _this_, test));
123:19